package zucc.edu.cn.chengchengparttime.LoginAndReg;

import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;

import zucc.edu.cn.chengchengparttime.MainActivity;
import zucc.edu.cn.chengchengparttime.R;

public class LoginActivity extends AppCompatActivity {
    private EditText input_account;
    private EditText input_password;
    private AppCompatButton btn_login_account;
    private AppCompatButton btn_login_phone;
    private AppCompatButton btn_register;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_login);

        input_account=(EditText) findViewById(R.id.input_account);
        input_password=(EditText) findViewById(R.id.input_password);
        btn_login_account=(AppCompatButton) findViewById(R.id.btn_login_account);
        btn_login_phone=(AppCompatButton) findViewById(R.id.btn_login_phone);
        btn_register=(AppCompatButton) findViewById(R.id.btn_register);

        btn_login_account.setOnClickListener(view -> {
            Toast.makeText(this, "点击了账号密码登录" , Toast.LENGTH_SHORT).show();
            //跳转到首页
            Intent i=new Intent();
            i.setClass(LoginActivity.this, MainActivity.class);
            //一定要指定是第几个pager，这里填写1
            i.putExtra("id",1);
            startActivity(i);
        });

        btn_login_phone.setOnClickListener(view -> {
            Toast.makeText(this, "点击了手机号登录" , Toast.LENGTH_SHORT).show();
            //跳转到手机号登录界面
            Intent intent=new Intent(LoginActivity.this, LoginPhoneActivity.class);
            startActivity(intent);
        });

        btn_register.setOnClickListener(view -> {
            Toast.makeText(this, "点击了注册" , Toast.LENGTH_SHORT).show();
            //跳转到注册界面
            Intent intent=new Intent(LoginActivity.this, RegisterActivity.class);
            startActivity(intent);
        });
    }
}
